﻿class com.gamepackage.events.Setter implements com.gamepackage.events.Executable
{
	private var listener: Object;
	private var property: String;
	private var source: Object;
	private var remotemethod: Function;

	function Setter( listener: Object, property: String, source: Object, remotemethod )
	{
		this.listener 	= listener;
		this.property 	= property;
		this.source	= source;
		
		if ( remotemethod instanceof Function )
		{
			this.remotemethod = remotemethod;
		}
		else
		{
			this.remotemethod = source[ remotemethod ];
		}
	}

	function execute(): Void
	{
		listener[ property ] = remotemethod.apply( source , null );
	}
}